<template>
	<div>
		<van-nav-bar title="AI卦师" />
		<div v-if="active===0" >
			<today></today>
			<van-divider />
			<edit></edit>
		</div>
		<div v-if="active===1">
			<list></list>
		</div>
		
		<van-tabbar v-model="active">
		<van-tabbar-item icon="wap-home-o">排盘</van-tabbar-item>
		<van-tabbar-item icon="list-switch">测算记录</van-tabbar-item> 
<!-- 		  <van-tabbar-item icon="guide-o">推广排名</van-tabbar-item> -->
		  
		</van-tabbar>
	</div>
</template>

<script setup>
	import today from './components/today.vue';
	import edit from './components/edit.vue';
	import list from './components/list.vue';
	import { ref,onMounted} from 'vue';
	import { weixin,getWxUserInfo} from '@/api/weixin';
 
const active=ref(0)

const init=()=>{
	
}

const initWeixin=()=> {
	//getWxUserInfo()
	weixin('https://wx.rscode.cn/zhouyi/index.html')
	.then(res=>{
		console.log('weixin res',JSON.stringify(res))
		let ret=res
		wx.config({
						debug: false,
						appId: ret.appId,
						timestamp: ret.timestamp,
						nonceStr: ret.nonceStr,
						signature: ret.signature,
		    jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData']
		})
	})
	
	wx.ready(function () {
			 
		    wx.checkJsApi({
		        jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
				success: function (res) {
					console.log(JSON.stringify(res))
		        }
		    });
		
			var title = "遇事不决，可问春风";
			var desc = "易学小游戏，正视传统文化，仅供娱乐。";
			var link = "https://wx.rscode.cn/zhouyi/index.html";
			var imgUrl = "https://wx.rscode.cn/public/bagua.png";
			//朋友圈
		    wx.updateTimelineShareData({
		        title: title, // 分享标题
		        link: link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
		        imgUrl: imgUrl, // 分享图标
		        success: function () {
		            // 设置成功
		            //UIkit.notification({ message: '己分享', status: 'success' })
		        }
			})
			//好友
		    wx.updateAppMessageShareData({
		        title: title, // 分享标题
		        desc: desc, // 分享描述
		        link: link, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
		        imgUrl: imgUrl, // 分享图标
		        success: function () {
		            // 设置成功
		            // UIkit.notification({ message: '己分享', status: 'success' })
		        }
			})
		})
		wx.error(function (res) {
			console.log(res)
		})
}

 
onMounted(()=>{
	initWeixin()
})
</script>

<style scoped>
	 
</style>